package com.sq.partner.manager.dao.impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.sq.partner.manager.dao.GatewayChannelDemandConfigDao;
import com.sq.partner.manager.mybatis.model.ActirationCardDifinition;
import com.sq.partner.manager.mybatis.model.GatewayChannelDemandConfig;
import com.sq.partner.manager.util.Page;

/**
 *
 * @author zsm 2019年1月16日
 *
 */
@Repository
public class GatewayChannelDemandConfigDaoImpl extends BaseDaoImpl implements GatewayChannelDemandConfigDao{

	@Override
	public Integer queryDemandCount(Map<String,Object>map) throws Exception {
		return (Integer) this.query("selectChannelDemandCount",map);
	}
	@Override
	public Page<GatewayChannelDemandConfig> queryDemandPage(Page<GatewayChannelDemandConfig> page) throws Exception {
		Integer i= queryDemandCount(page.getMap());
		page.setTotal(i);
		List<GatewayChannelDemandConfig> data=(List<GatewayChannelDemandConfig>)this.queryList("selectChannelDemandPage", page.getMap());
		page.setData(data);
		return page;
	}
	@Override
	public void insertDemands(List<GatewayChannelDemandConfig> list)
			throws Exception {
			this.batchInsert("addDemands", list);	
	}
	@Override
	public void addVersion(GatewayChannelDemandConfig gatewayChannelDemandConfig)
			throws Exception {
		this.add("addVersion", gatewayChannelDemandConfig);
		
	}
	@Override
	public GatewayChannelDemandConfig selectDemandForUpdate(
			Map<String, Object> map) throws Exception {
		
		return (GatewayChannelDemandConfig) this.query("selectDemandForUpdate", map);
	}
	@Override
	public boolean updateDemandByID(GatewayChannelDemandConfig info)
			throws Exception {
		
		return this.update("updateDemandByID", info);
	}
	@SuppressWarnings("unchecked")
	@Override
	public List<GatewayChannelDemandConfig> selectDemandCost(
			Map<String, Object> map) throws Exception {
		
		return this.queryList("selectDemandCost", map);
	}
	@Override
	public void addCost(GatewayChannelDemandConfig config) throws Exception {
		this.add("addCost", config);
	}
	@SuppressWarnings("unchecked")
	@Override
	public List<GatewayChannelDemandConfig> queryPartnerInfo(GatewayChannelDemandConfig info) throws Exception {
		
		return this.queryList("queryPartnerInfo", info);
	}
	@SuppressWarnings("unchecked")
	@Override
	public List<GatewayChannelDemandConfig> queryVersionInfo(GatewayChannelDemandConfig info) throws Exception {
		
		return this.queryList("queryVersionInfo", info);
	}
	@SuppressWarnings("unchecked")
	@Override
	public List<GatewayChannelDemandConfig> queryDemandInfo(GatewayChannelDemandConfig info) throws Exception {
		
		return this.queryList("queryDemandInfo", info);
	}
	@Override
	public boolean deleteChannelCost(Map<String,Object>map)
			throws Exception {
		
		return this.delete("deleteChannelCost", map);
	}
	@Override
	public boolean deleteChannelDemand(Map<String,Object>map)
			throws Exception {

		return this.delete("deleteChannelDemand", map);
	}
	@Override
	public int queryVersionExist(String channelVersion) throws Exception {
		
		return (Integer) this.query("queryVersionExist",channelVersion);
	}
	@SuppressWarnings("unchecked")
	@Override
	public List<GatewayChannelDemandConfig> demandExportSelect(
			Map<String, Object> map) throws Exception {
		
		return this.queryList("demandExportSelect", map);
	}
	@Override
	public boolean updateDemandCostByID(GatewayChannelDemandConfig info)
			throws Exception {
		
		return  this.update("updateDemandCostByID", info);
	}
	@SuppressWarnings("unchecked")
	@Override
	public List<String> queryChannelCodeByParameter(Map<String, Object> map)
			throws Exception {
		
		return this.queryList("queryChannelCodeByParameter", map);
	}



}
